home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / AEA / Source / Sources / Apple Events / AEAAppleEvent.cc next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  941 b   |  50 lines

  1. /*    ================
  2.  *    AEAAppleEvent.cc
  3.  *    ================
  4.  */
  5.  
  6. #include "AEADebugging.h"
  7.  
  8. #include <string.h>
  9.  
  10. #include <AppleEvents.h>
  11.  
  12. #include "AEAAppleEvent.hh"
  13.  
  14. NGLList<AEAAppleEvent *> AEAAppleEvent::sWaitingEvents;
  15.  
  16. AEAAppleEvent::AEAAppleEvent(const AppleEvent &inAppleEvent)
  17. : mAppleEvent(gNullDesc), mReply(gNullDesc), mSent(false)
  18. {
  19.     OSErr err;
  20.     
  21.     err = ::AEDuplicateDesc(&inAppleEvent, &mAppleEvent);
  22.     ThrowIfOSErr_(err);
  23.     
  24.     sWaitingEvents.Append(this);
  25. }
  26.  
  27. AEAAppleEvent::~AEAAppleEvent()
  28. {
  29.     OSErr err;
  30.     
  31.     sWaitingEvents.Remove(this);
  32.     
  33.     err = ::AEDisposeDesc(&mAppleEvent);
  34.     err = ::AEDisposeDesc(&mReply);
  35.     ThrowIfOSErr_(err);
  36. }
  37.  
  38. void
  39. AEAAppleEvent::Send(AESendMode inReplyMode, AEIdleUPP &inAEIdleUPP)
  40. {
  41.     OSErr err;
  42.     
  43.     err = ::AESend(&mAppleEvent, &mReply, inReplyMode | kAECanInteract, kAENormalPriority,
  44.         15 * 60, inAEIdleUPP, NULL);
  45.     ThrowIfOSErr_(err);
  46.     mSent = true;
  47.     
  48.     //if (inReplyMode == kAENoReply) delete this;
  49. }
  50.